#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
/*
Copyright (C) 2013 Johan Ceuppens

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
typedef void* __SIGCM_RETURNTYPE;
typedef void* __SIGCM_TYPE;
typedef __SIGCM_TYPE __SIGCM_TYPENAMES[7];//7 typenames, FIXME accumulator
#define __SIGCM_ACCUMULATOR 0
#define __SIGCM_RESET_ACCUMULATOR \
	#define __SIGCM_ACCUMULATOR 0 \

#define __SIGCM_CAT(foo,bar) \
	return strcat(foo,bar) 

#define __SIGCM_TEMPLATEHEADER2CLASS(class,typename) \
	 @interface __SIGCM_CAT(class,typename) \

//TODO, objc++ or this template header parser
#define ReParseClass(ClassHeader,ClassVars,ClassMethods,ClassName) \
	@interface ClassName \
	putClass(ClassHeader) /*and change template params to typename*/\
	ClassVars \
	@end \
	ClassMethods

//TODO FIX	
#define __SIGCM_TEMPLATE(class,typenames,vardecl,methoddecl) \
	while (__SIGCM_ACCUMULATOR < 7 && typenames[__SIGCM_ACCUMULATOR]) {\
	 	__SIGCM_TEMPLATEHEADER2CLASS(class,typenames[__SIGCM_ACCUMULATOR]) \
		vardecl \
		@end \
		methoddecl \
		} \
		__SIGCM__RESET_ACCUMULATOR; \

/*
 * All _SIGCM_TEMPLATEX(classn, typename, ..., classdecl)
 * write out a macro "class "classn concatted to typename" with the
 * same declaration. definitions of functions must be made seperately
 */
#define __SIGCM_TEMPLATE1(class,typename1,vardecl,methoddecl) \
	 	__SIGCM_TEMPLATEHEADER2CLASS(class,typename1) \
		vardecl \
		@end \
		methoddecl \

#define __SIGCM_TEMPLATE2(class,typename1,typename2, vardecl,methoddecl) \
	 	__SIGCM_TEMPLATE1(class,typename1) \
	 	__SIGCM_TEMPLATE1(class,typename2) \

//TODO, objc++ or this template header parser
#define ReParseClass(ClassHeader,ClassVars,ClassMethods,ClassName) \
	@interface ClassName \
	putClass(ClassHeader) /*and change template params to typename*/\
	ClassVars \
	@end \
	ClassMethods 
	
